Skip to content

fix: exclude .claude from git tracking in worktrees#23

Open
dakl wants to merge 1 commit intomainfrom
symlink-issues
Open

fix: exclude .claude from git tracking in worktrees#23
dakl wants to merge 1 commit intomainfrom
symlink-issues

Conversation

@dakl
Copy link
Copy Markdown
Owner

@dakl dakl commented Mar 25, 2026

Summary

  • When Codez creates a worktree, it replaces .claude/ with a symlink to the main repo's .claude/ directory. Git operations (merge, stash, checkout) then fail with error: '.claude/...' is beyond a symbolic link because git refuses to write tracked files through symlinks.
  • Fix: after symlinking, add .claude to the repo's info/exclude and remove .claude entries from the worktree's index via git rm --cached. This makes git ignore the symlinked .claude in worktrees while the main repo continues to track it normally.

Test plan

  • New test: verify .claude is added to info/exclude and doesn't show as untracked in git status
  • New test: verify git merge works in worktree after .claude is symlinked (no "beyond a symbolic link" error)
  • New test: verify duplicate .claude entries aren't added to exclude file
  • All existing worktree tests pass (25/25)
  • Lint clean

🤖 Generated with Claude Code

When Codez replaces .claude/ with a symlink in worktrees, git operations
(merge, stash, checkout) fail with "beyond a symbolic link" errors. Fix
by adding .claude to the repo's info/exclude and removing it from the
worktree's index after symlinking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant